<template lang="html">
  <div class="header">
    <div class="goBack" @click="goBack">
      <i class="iconfont">&#xe66c;</i>
    </div>
    <transition>
      <div class="header_title" v-if="showTitleText">
        {{title}}
      </div>
    </transition>
    <div class="header_right">

    </div>
  </div>
</template>

<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
  props: {
    title: {
      type: null,
      required: true
    },
    showTitleText: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    goBack () {
      window.location.href = 'gtjanormal://goback'
    }
  }
})
</script>

<style lang="less" scoped>
.v-enter-active,  .v-leave-active {
  transition: opacity 0.3s;
}
.v-enter, .v-leave-active {
  opacity: 0;
}
.header {
  text-align: center;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2000;
  color: #fff;
  width: 100%;
  height: 45px;
  display: flex;
  font-size: 18px;
  align-items: center;
  background-color: #26A8FF;
  .goBack {
    flex-basis: 10%;
  }
  .header_title {
    flex-basis: 80%;
  }
  .header_right {
    flex-basis: 10%;
  }
}
</style>
